import { defineStore } from 'pinia'
import { ref } from 'vue'

// 定义 Store
export const usePlayStore = defineStore(
  'play',
  () => {
    // 是否有音乐在播放
    const isPlaying = ref<boolean>(false)

    // 记得 return
    return { isPlaying }
  },
  // TODO: 持久化
  {
    persist: {
      storage: {
        getItem(key: any) {
          return uni.getStorageSync(key)
        },
        setItem(key: any, value: any) {
          uni.setStorageSync(key, value)
        },
      },
    },
  },
)
